package com.opencv.formatter;

import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.opencv.annotation.DateFormatterToLong;

/**
 * @author qz.wu
 * @date 2021/11/23 18:26
 * @descriptions Date转Long格式化日期功能的具体实现
 */
public class DateFormatterLongAnnotationIntrospector extends JacksonAnnotationIntrospector {

    @Override
    public Object findSerializer(Annotated annotated) {
        DateFormatterToLong formatter = annotated.getAnnotation(DateFormatterToLong.class);
        if (formatter != null) {
            return new LongSerializer();
        }
        return super.findSerializer(annotated);
    }
}
